<%-- Copyright (C) 2009 WorkSmart Labs, Inc. --%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%-- 
    This is a simple JSP template for creating a challenge. It lets you input a name
    for the challenge, an id that will be part of the URL and a small description.  
    @author mark
--%>
<!DOCTYPE html>

<%@page import="com.wsl.HealthChallenge.models.ContestType"%><html lang="en-us">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>Health Challenge</title>
  <link rel="stylesheet" type="text/css" href="/static/healthchallenge.css">
  <%
    String challengeName = (String) request.getAttribute("challengeName");
    String challengeId = (String) request.getAttribute("challengeId");
    String takenChallengeId = (String) request.getAttribute("takenChallengeId");
    String invalidChallengeId = (String) request.getAttribute("invalidChallengeId");
    String signedInUserEmail = (String) request.getAttribute("signedInUserEmail");
    String signInUrl = (String) request.getAttribute("signInUrl");
    String signOutUrl = (String) request.getAttribute("signOutUrl");
  %>
</head>

<body>
  <div id="welcomeContainer">
    <a href="http://tamaraolsondesigns.com/healthchallenge3/index.html">
      <img src="/static/smallerLogo.png" width="300" height="126">
    </a>
  </div>
<form action="" method="get">
  <div id="signUp">
    <div class="dropShadow">
      <h1>Welcome!</h1>
      <h2>Challenge your friends, family, co-workers... anyone!</h2>
      <h3>To start a new challenge</h3>
      <p>Pick your challenge id (like a Twitter name, e.g. 'smithsfunrun'), 
      	enter a name, and pick a contest type. Hit <i>Create</i>, and invite some people!
      	Then, go!</p>
      <% if (takenChallengeId != null) { %>
        <p class="alert">Oops, '<%=takenChallengeId%>' is already taken. <br/> Please pick another id.</p>
      <% } else if (invalidChallengeId!= null) { %>
        <p class="alert">Oops, '<%=invalidChallengeId%>' is an invalid id. <br/> Please pick another id.</p>
      <% } %>
      <div class="labelAndInput">
        <label>Challenge ID:</label>
        <input type="text" name="id" value="<%=challengeId%>" />
      </div>
      <div class="labelAndInput">
        <label>Challenge name:</label>
        <input type="text" name="name" value="<%=challengeName%>"/>
      </div>
      <div class="labelAndInput">
        <label>Type of challenge:</label>
        <select name="contestType">
        <% for (ContestType contestType : ContestType.values()) { %>
         <option value="<%=contestType.stringRepresentation%>" >
           <%=contestType.displayName%>
         </option>
        <% } %>
        </select>
      </div>
      <p class="note">Health Challenge requires you to sign in with your
        Google account. Note that Health Challenge does not work with Google
        Apps accounts, so please use your personal Google account.</p>
      <button class="submitBtn" type="submit" >
        Create a challenge &#62;&#62;
      </button>
      <h3>Looking for an existing challenge?</h3>
      <p>Follow the link in the invitation you received, or if you know
         the ID of the challenge, go directly to http://walk2.me/[challenge id]/</p>
    </div>
  </div>
 </form>
</body>
</html>